package Bean;

public class JobExperienceBean implements Comparable<JobExperienceBean> {
    String job;
    int experience;

    public JobExperienceBean(String job, int experience) {
        this.job = job;
        this.experience = experience;
    }

    public String getJob() {
        return job;
    }

    public int getExperience() {
        return experience;
    }

    @Override
    public int compareTo(JobExperienceBean other) {

        int cmp = Integer.compare(other.experience, this.experience);
        if (cmp != 0) {
            return cmp;
        }

        return this.job.compareTo(other.job);
    }

    @Override
    public String toString() {
        return job + ": " + experience + "年";
    }
}
